
<h1><span class="yiyi-st" id="yiyi-12">numpy.testing.decorators.setastest</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.decorators.setastest.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.testing.decorators.setastest.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.testing.decorators.setastest"><span class="yiyi-st" id="yiyi-13"> <code class="descclassname">numpy.testing.decorators.</code><code class="descname">setastest</code><span class="sig-paren">(</span><em>tf=True</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/testing/decorators.py#L58-L89"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-14">信号到鼻子，这个函数是或不是一个测试。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-15">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-16"><strong>tf</strong>：bool</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-17">如果为True，指定装饰的callable是一个测试。</span><span class="yiyi-st" id="yiyi-18">如果为False，则指定装饰的可调用项不是测试。</span><span class="yiyi-st" id="yiyi-19">默认值为True。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric"><span class="yiyi-st" id="yiyi-20">笔记</span></p>
<p><span class="yiyi-st" id="yiyi-21">这个装饰器不能使用鼻子命名空间，因为它可以从非测试模块调用。</span><span class="yiyi-st" id="yiyi-22">另请参见<code class="docutils literal"><span class="pre">nose.tools</span></code>中的<code class="docutils literal"><span class="pre">istest</span></code>和<code class="docutils literal"><span class="pre">nottest</span></code>。</span></p>
<p class="rubric"><span class="yiyi-st" id="yiyi-23">例子</span></p>
<p><span class="yiyi-st" id="yiyi-24"><a class="reference internal" href="#numpy.testing.decorators.setastest" title="numpy.testing.decorators.setastest"><code class="xref py py-obj docutils literal"><span class="pre">setastest</span></code></a>可以按以下方式使用：</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">numpy.testing.decorators</span> <span class="k">import</span> <span class="n">setastest</span>

<span class="nd">@setastest</span><span class="p">(</span><span class="kc">False</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">func_with_test_in_name</span><span class="p">(</span><span class="n">arg1</span><span class="p">,</span> <span class="n">arg2</span><span class="p">):</span>
    <span class="k">pass</span>
</pre></div>
</div>
</dd></dl>
